<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>百度 AI and Map</title>
    <script src="http://api.map.baidu.com/api?type=webgl&v=1.0&ak=GQ0nBPXkafYw3GN8C42WgMAwGa9jxkLK"></script>
    <style>
    * {
        margin: 0;
        padding: 0;
    }
    html, body {
        height: 100%;
    }
    #container {
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
    </style>
</head>
<body>
<!-- <script src="./js/utils.js"></script> -->
<div id="container"></div>
<script>
// Protocol http:// 应答响应  request  response 
// Domain api.map.baidu.com 二级域名
// Path /api
// QueryString 
// let url = 'http://api.map.baidu.com/api?abc'
// let url = 'http://api.map.baidu.com/api?type=webgl&v=1.0&ak=GQ0nBPXkafYw3GN8C42WgMAwGa9jxkLK';
// let qsResult = getQueryStringObj(url);
// console.log(qsResult); 
var map = new BMapGL.Map('container');
map.centerAndZoom('南昌', 12);
map.enableScrollWheelZoom(true);
const data = [
    {
        lon: 115.832777,
        lat: 28.724024,
        address: '东华理工大学',
        people: '杨执信',
        doTing: '打破就业记录'
    },
    {
        lon: 115.823175,
        lat: 28.737119,
        address: '江西财经大学',
        people: '刘天瞳',
        doTing: '腾讯大佬'
    }, 
    {
        lon: 116.025864,
        lat: 28.686736,
        address: '江西科技学院',
        people: '李晋欣',
        doTing: '百度大佬'
    }
]
data.forEach(function(item){
    var marker = new BMapGL.Marker(
        new BMapGL.Point(
            item.lon,
            item.lat,
        )
    )
    map.addOverlay(marker);
    let content = [item.address, item.people, item.doThing];
    addClickHandler(content, marker, map);
})

function addClickHandler(content, marker, map) {
    marker.addEventListener('click', function(e) {
        console.log(e, content, '--------------')
    })
}
</script>
</body>
</html>